<template>
  <div class="main">
    <mapDrag @drag="dragMap"  lat="39.90923" lng="116.397428" class="mapbox"></mapDrag>
  </div>
</template>

<script>
  import mapDrag from '../../components/mapDrag'
  export default {
    name: 'app',
    components: {
      mapDrag
    },
    data () {
      return {
        dragData: {
          lng: null,
          lat: null,
          address: null,
          nearestJunction: null,
          nearestRoad: null,
          nearestPOI: null
        }
      }
    },
    methods: {
      dragMap (data) {
        this.dragData = {
          lng: data.position.lng,
          lat: data.position.lat,
          address: data.address,
          nearestJunction: data.nearestJunction,
          nearestRoad: data.nearestRoad,
          nearestPOI: data.nearestPOI
        }
      }
    }
  }
</script>

<style scoped>
  .main {
    width: 100%;
    height: 100%;
  }
  .mapbox{ width: 100%; height: 100%; }

</style>
